home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / fgl110c.zip / 08-09.C < prev    next >
Text File  |  1992-01-31  |  1KB  |  54 lines

  1. #include <fastgraf.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void main(void);
  6.  
  7. void main()
  8. {
  9.    int new_mode, old_mode;
  10.    int status;
  11.  
  12.    new_mode = fg_bestmode(320,200,1);
  13.    if (new_mode < 0 || new_mode == 12) {
  14.       printf("This program requires a 320 ");
  15.       printf("x 200 color graphics mode.\n");
  16.       exit(1);
  17.       }
  18.    old_mode = fg_getmode();
  19.    fg_setmode(new_mode);
  20.  
  21.    status = fg_initxms();
  22.    if (status == 0) status = fg_allocxms(8);
  23.    if (status < 0) {
  24.       status = fg_initems();
  25.       if (status == 0) status = fg_allocems(8);
  26.       }
  27.    if (status < 0) status = fg_alloccms(8);
  28.  
  29.    if (status < 0) {
  30.       fg_setmode(old_mode);
  31.       fg_reset();
  32.       printf("Unable to create logical page.\n");
  33.       exit(1);
  34.       }
  35.  
  36.    fg_setcolor(7);
  37.    fg_rect(0,319,0,199);
  38.    fg_setcolor(9);
  39.    fg_locate(12,18);
  40.    fg_text("test",4);
  41.    fg_waitkey();
  42.  
  43.    fg_copypage(0,8);
  44.    fg_erase();
  45.    fg_waitkey();
  46.  
  47.    fg_copypage(8,0);
  48.    fg_waitkey();
  49.  
  50.    fg_freepage(8);
  51.    fg_setmode(old_mode);
  52.    fg_reset();
  53. }
  54.